﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace PitOfDespair.Dungeon
{
    public enum WallType
    {
        Open,
        SolidWall,
        Descend,
        Ascend,
        Locked,
        Door
    }

    class Location
    {
        public int Treasure { get; set; }
        Dictionary<WallType, Color> wallColorMap = new Dictionary<WallType, Color>()
                                                       {
                                                           { WallType.Ascend, Color.Red }, { WallType.Descend, Color.Blue },
                                                           { WallType.Door, Color.Brown }, { WallType.Locked, Color.Gray }
                                                       };
        Color WallColor(WallType wall)
        {

            if (wallColorMap.ContainsKey(wall))
                return wallColorMap[wall];
            return Color.Black;
        }
        public void DrawFogged(Action<Rectangle,Color> drawAction, int scale)
        {
            drawAction(new Rectangle(0, 0, scale, scale), Color.LightGray);
        }
        public void Draw(Action<Rectangle,Color> drawAction,int scale)
        {
            if (Treasure > 0)
                drawAction(new Rectangle(scale/2,scale/2, 2, 2), Color.Yellow);
            if (North != WallType.Open)
                // draw north at x,y +startpoint between each room wall there's a 1 pixel margin
                drawAction(new Rectangle(0, 0, scale,1), WallColor(North));

            if (South != WallType.Open)
                drawAction(new Rectangle(0,scale-1,scale,1), WallColor(South));
            if (West != WallType.Open)
                drawAction(new Rectangle(0,0,1,scale), WallColor(West));
            if (East != WallType.Open)
                drawAction(new Rectangle(scale-1,0,1,scale), WallColor(East));
            

        }

        public Location(WallType west, WallType east, WallType north, WallType south)
        { 
            West = west;
            East = east;
            North = north;
            South = south;
        }
        public WallType West { get; private set; }
        public WallType East { get; private set; }
        public WallType North { get; private set; }
        public WallType South { get; private set; }
        
    }
}
